

#ifndef ITERM2_CANVAS_H
#define ITERM2_CANVAS_H

#include "display_options.h"
#include "terminal_canvas.h"
#include "thread_pool.h"

namespace tv {
// Implements https://iterm2.com/documentation-images.html
class ITerm2GraphicsCanvas final : public TerminalCanvas {
public:
  ITerm2GraphicsCanvas(BufferedWriteSequencer *ws, ThreadPool *thread_pool,
                       const DisplayOptions &opts);

  int cell_height_for_pixels(int pixels) const final;

  void Send(int x, int dy, const Framebuffer &framebuffer,
            SeqType sequence_type, Duration end_of_frame) override;

private:
  const DisplayOptions &options_;
  ThreadPool *const executor_;

  char *RequestBuffer(int width, int height);
};
} // namespace tv
#endif // ITERM2_CANVAS_H
